<template>
    <div class="table">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-menu"></i>{{$route.name}}
                </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="handle-box">
        </div>
        <div>
            <el-form ref="form" :model="form" label-width="200px">
                <el-form-item label="最新版本号:">
                    <el-input v-model="form.version" placeholder="填写版本号"></el-input>
                </el-form-item>
                <el-form-item label="最新版本名称:">
                    <el-input v-model="form.name" placeholder="填写版本名称"></el-input>
                </el-form-item>
                <el-form-item label="更新内容:">
                    <el-input v-model="form.content" placeholder="填写更新内容"></el-input>
                </el-form-item>
                <el-form-item label="安装包大小:">
                    <el-input v-model="form.size" placeholder="填写安装包大小"></el-input>
                </el-form-item>
                <el-form-item label="安装包下载URL:">
                    <el-input v-model="form.downloadUrl" placeholder=""></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="info" @click="add">保存</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>
<script>
import { putVersion, getVersion } from '../../api/server.js'
export default {
    data() {
        return {
            form: {
            }
        }
    },
    created() {
        this.get_version()
    },
    methods: {
        get_version() {
            getVersion()
                .then(res => {
                    this.form = res.result
                })
        },
        add() {
            let form = this.form
            form.versionName = form.name
            form.apkSize = form.size
            putVersion(form)
                .then(res => {
                    this.$message.success('修改成功')
                })
        }
    }
}
</script>
<style lang="scss" scoped>
.handle-box {
  margin-bottom: 2%;
  .search {
    width: 30%;
  }
}

.block {
  text-align: center;
  margin-top: 1%;
}
</style>